package com.syni.mdd.sjb.common.datatreaure.controller.protect.dataTreasure.common;

import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckUserIdentity;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.databank.DataBankCommonVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.databank.UnifiedPushVo;
import com.syni.mdd.sjb.common.datatreaure.service.DxshAppNewsService;
import com.syni.mdd.sjb.common.datatreaure.service.DxshAppUserChannelService;
import com.syni.mdd.sjb.common.datatreaure.service.databank.DataBankCommonService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/databank/common")
@Log4j2
public class BankCommonController {

    @Autowired
    DataBankCommonService dataBankCommonService;

    @Autowired
    DxshAppNewsService dxshAppNewsService;

    @Autowired
    DxshAppUserChannelService dxshAppUserChannelService;

    @PostMapping("/homePageData")
    @ApiOperation(value = "觅东东数据宝首页数据")
    @CheckUserIdentity
    public Map<String,Object> homePageData(@RequestBody @Validated DataBankCommonVo dataBankCommonVo){
        return dataBankCommonService.homePageData(dataBankCommonVo);
    }

    @PostMapping("/newDetailParams")
    @ApiOperation(value = "用于消息详情跳转获取参数")
    @CheckUserIdentity
    public Map<String,Object> newDetailParams(@RequestBody @Validated DataBankCommonVo dataBankCommonVo){
        return dataBankCommonService.newDetailParams(dataBankCommonVo.getNewId());
    }

    @PostMapping("/unifiedPush")
    @ApiOperation(value = "统一消息推送")
    //@CheckUserIdentity
    public Map<String,Object> unifiedPush(@RequestBody @Validated UnifiedPushVo unifiedPushVo){
        return dataBankCommonService.unifiedPush(unifiedPushVo);
    }

    @PostMapping("/synchronizeData")
    @ApiOperation(value = "同步数据结构")
    public Map<String,Object> synchronizeData(){
        return dataBankCommonService.synchronizeData();
    }


    @PostMapping("/synchronizeDxshAppNews")
    @ApiOperation(value = "同步电享生活消息体系")
    public Map<String,Object> synchronizeDxshAppNews(){
        return dataBankCommonService.synchronizeDxshAppNews();
    }


}
